package com.winit.uschedule.web;

import com.winit.uschedule.manager.UsTaskDefineManager;
import com.winit.uschedule.manager.UsTaskManager;
import com.winit.uschedule.model.UsTaskDefine;
import com.winit.uschedule.model.UscheduleTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by wanglin on 2018/6/13.
 */
@Component
@Api(value = "Uschedule", tags = {"Uschedule"}, description = "Uschedule")
@RestController
@RequestMapping("/api/v1/uschedule")
public class UscheduleController {


    @Autowired
    UsTaskDefineManager usTaskDefineManager;

    @Autowired
    UsTaskManager usTaskManager;

    @RequestMapping(value = "/getAll", method = RequestMethod.GET)
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "获取全部数据")
    @ResponseBody
    public List<UsTaskDefine> findAll(){
        return  usTaskDefineManager.getAll();
    }
    @RequestMapping(value = "/findById", method = RequestMethod.GET)
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "iD获取task信息")
    @ResponseBody
    public UscheduleTask findById(
            @ApiParam(value = "id",required = true) @RequestParam(value = "id", required = true) String id
    ){
        return  usTaskManager.findById(id);
    }





}
